Repository navigation
Conversation
Use apt-get instead of yum for DEB-based guests when removing
cloud-init and openssh-server, purge the aliyun-assist DEB package,
and fix the sshd_config.d drop-in files Ubuntu ships, which are read
after sshd_config and would override the hardened values. Make the
account-cleanup guest script POSIX sh so it runs on guests without
bash, and replace history -c (which only clears the customize
session) with removal of the history files.
The dpkg-query package-list field is ${binary:Package}; the
${dpkg-Package} spelling used previously expands to nothing on
noble, so the aliyun purge was a silent no-op there.
Assisted-by: Claude Code:glm-5.3
Signed-off-by: Kun Lai <laikun@linux.alibaba.com>
Refresh the apt indexes and pre-install dracut, dracut-network, lvm2 and cryptsetup-bin before dpkg -i, so the cryptpilot-fde-guest deb resolves its dependencies instead of failing configuration. Skip cryptpilot-fde-guest in the essential-package apt-get pass: a version string detected on an RPM-based host matches no apt candidate and fails the whole install. Make the zram module install best-effort; Ubuntu kernels without a linux-image-*-generic name would otherwise abort the conversion. Also fix the cryptpilot-fde-host version probe: rpm writes its "package is not installed" message to stdout, so "|| true" inside the command substitution captures that text as the version on hosts that have rpm but no cryptpilot-fde-host. Move the fallback outside the substitution, matching the pattern already used by the RPM installer. Assisted-by: Claude Code:glm-5.3 Signed-off-by: Kun Lai <laikun@linux.alibaba.com>
Ubuntu cloud images ship without a grubenv block and without GRUB_DEFAULT=saved. cryptpilot-fde-host show-reference-value reads saved_entry, so create the 1024-byte grubenv when missing, pick the newest non-rescue kernel (stripping the vmlinuz- prefix to match Ubuntu's menuentry format) and set GRUB_DEFAULT=saved in /etc/default/grub and its grub.d drop-ins. Disable os-prober before running grub-mkconfig: it scans every block device and fails with "Device or resource busy" inside containers with NBD devices attached, leaving a grub.cfg without menuentries. Assisted-by: Claude Code:glm-5.3 Signed-off-by: Kun Lai <laikun@linux.alibaba.com>
Some cloud images ship an ESP too small for a UKI plus the scratch space firmware needs while booting it (Ubuntu noble: ~106M). In UKI mode, when the output ESP is below 250M, rewrite the output partition table with the ESP grown to 512M at its current start and every later partition shifted behind it, preserving type, uuid and size, with starts aligned to 2048 sectors as elsewhere. The last partition shrinks only when the shifted layout would run past the disk end. The layout is parsed from sfdisk --dump --json and emitted as a fresh sfdisk script via python3, and each entry keeps its "<device>pN :" prefix so sfdisk preserves the original partition numbers. Partition UUIDs survive because the guest grub.cfg references them. Since the partition was enlarged, dd of the source ESP would restore the small vfat superblock and leave dracut hitting ENOSPC, so copy_partitions instead creates a fresh vfat spanning the enlarged partition (keeping the source label, which Ubuntu's fstab mounts the ESP by) and copies the source content. The plain dd path is unchanged for every other case. Assisted-by: Claude Code:glm-5.3 Signed-off-by: Kun Lai <laikun@linux.alibaba.com>
Add --distro <alinux3|ubuntu> and --deb/--package as alternatives to --rpm. For Ubuntu, download the pinned noble 20260518 cloud image, grow it to 10G and relocate the backup GPT: the stock image is too small for the converted layout, and the conversion installs dracut itself so no guest preparation is needed. A custom --input image counts as already prepared and skips cryptpilot-enhance. Detect a successful Ubuntu boot from "Welcome to Ubuntu", a ttyN login: line, or systemd reaching multi-user, since Ubuntu cloud images do not print the alinux login banner on the serial console. Raise the boot timeout to 15 minutes for TCG runners. Assisted-by: Claude Code:glm-5.3 Signed-off-by: Kun Lai <laikun@linux.alibaba.com>
build-deb.yml gains a test-convert job (needs build and test) with a grub/uki matrix that runs tests/test-convert.sh with the freshly built cryptpilot-fde-guest deb against the prepared noble test image. The tool list is minimal: the harness needs wget, qemu-utils, cryptsetup, lvm2, e2fsprogs, gdisk, parted and dosfstools (the UKI ESP re-creation); cryptpilot-convert installs anything else itself. No libguestfs is needed, the current convert pipeline does not use it. build-test-image.yml gains a distro input: "ubuntu" prepares a Noble cloud image (pinned 20260518 daily) by setting a root password, growing the disk to 10G with a GPT repair, and pre-installing dracut and systemd-boot-efi via qemu-nbd + chroot, then packages the result as the ghcr test image like the direct mode does. Assisted-by: Claude Code:glm-5.3 Signed-off-by: Kun Lai <laikun@linux.alibaba.com>
Assisted-by: Claude Code:glm-5.3 Signed-off-by: Kun Lai <laikun@linux.alibaba.com>
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
5 tasks done
Collaborator
Author
|
Closing in favor of a clean-room rewrite: the script changes here are being redone from scratch on a fresh branch against current master (tests/CI will follow in a separate PR stacked on it). |
6 of 8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ubuntu 24.04 LTS (Noble) cloud image support for cryptpilot-convert and cryptpilot-enhance, stacked on #164.
/etc/ssh/sshd_config.d/*.confdrop-ins (Ubuntu's drop-ins are read after the main file and would otherwise override the hardened values), purge the aliyun-assist DEB packages, and run the account-cleanup guest script under POSIXsh. Fixed while porting: the olddpkg-query -W -f='${dpkg-Package}'never worked (invalid field name, and the nested quoting made the host shell expand it) — now uses${binary:Package}with correct quote-splicing.dracut dracut-network lvm2 cryptsetup-binbeforedpkg -i(dependency resolution),apt-get -f installafter; cryptpilot-fde-guest is excluded from the essential-package apt pass; zram module install is best-effort. Fixed the version-detection bug this PR inherited from master:rpm -q ... || truecaptured rpm's stdout error text as the version string on hosts that have rpm but no cryptpilot-fde-host package.saved_entryfor images lacking one (Ubuntu cloud images), setGRUB_DEFAULT=saved, and disable os-prober (it scans NBD devices and fails inside containers, leaving grub.cfg without menuentries).sfdisk --dump --json+ python3 computes a new layout with the ESP grown to 512M and later partitions shifted (aligned, type/uuid preserved, partition numbers pinned via the<device>pNprefix); the output ESP is then re-created with mkfs.vfat at full size (label preserved) and populated from the source, so dracut can write the UKI without hitting ENOSPC. The plain-dd copy path is unchanged for all non-resize cases.--distro <alinux3|ubuntu>and--debsupport, Ubuntu image download/grow/prepare, Ubuntu login-prompt detection, skip enhance when--inputis a custom image.test-convert(grub/uki) job in build-deb.yml running against the prepared noble test image, and anubuntumode in build-test-image.yml producing that image. No libguestfs dependencies (the current convert pipeline does not use it).Supersedes the Ubuntu half of #110.
Test plan
saved_entry=6.8.0-117-generic, os-prober drop-in in place, version detection fails cleanly (empty version + warning, not rpm's error text).--uki-stub-version 258: rc=0; the resize fired ("Growing EFI partition p15 to 512M"), output ESP is 512M with the ~80M UKI atEFI/BOOT/BOOTX64.EFI, all PARTUUIDs preserved, rootfs shrank 9G to 8.6G.bash -n,shellcheck(convert/enhance/test-convert),cargo fmt --checkclean.test-convertlegs against the prepared noble image (first run on this PR).Known follow-ups